package com.tianji.remark;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author Encounter
 * @date 2024/11/28 21:06<br/>
 */
@Slf4j
@EnableScheduling
@SpringBootApplication
@MapperScan("com.tianji.remark.mapper")
public class RemarkApplication
    {
        public static void main(String[] args) throws UnknownHostException
            {
                SpringApplication app = new SpringApplicationBuilder(RemarkApplication.class).build(args);
                Environment env = app.run(args).getEnvironment();
                String protocol = "http";
                if (env.getProperty("server.ssl.key-store") != null)
                    {
                        protocol = "https";
                    }
                log.info("--/\n---------------------------------------------------------------------------------------\n\t" +
                                "Application '{}' is running! Access URLs:\n\t" +
                                "Local: \t\t{}://localhost:{}\n\t" +
                                "External: \t{}://{}:{}\n\t" +
                                "Profile(s): \t{}" +
                                "\n---------------------------------------------------------------------------------------",
                        env.getProperty("spring.application.name"),
                        protocol,
                        env.getProperty("server.port"),
                        protocol,
                        InetAddress.getLocalHost().getHostAddress(),
                        env.getProperty("server.port"),
                        env.getActiveProfiles());
            }
    }
